#include <iostream>
#include <vector>
#include <string>

std::vector<std::string> digit = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};

int simple(int n) {
    int d = 0;
    for (int i = 1; i <= n; i++) {
        if (n % i == 0) {
            d++;
        }
    }
    if (d == 2) {
        return n;
    }
    return 0;
}

int main() {
    std::string input;
    std::getline(std::cin, input);
    std::vector<std::string> num;
    std::string temp = "";
    for (char c : input) {
        if (c == ' ') {
            num.push_back(temp);
            temp = "";
        } else {
            temp += c;
        }
    }
    num.push_back(temp);

    int flag = 0;
    if (num.size() != 3) {
        std::cout << "Wrong input" << std::endl;
    } else {
        int s, d, e;
        for (int i = 0; i < digit.size(); i++) {
            if (num[0] == digit[i]) {
                s = i;
            }
            if (num[1] == digit[i]) {
                d = i;
            }
            if (num[2] == digit[i]) {
                e = i;
            }
        }
        int n = s * 100 + d * 10 + e;
        std::cout << simple(n) << std::endl;
    }

    return 0;
}
